package org.ivan.btrace.isale;

import com.sun.btrace.BTraceUtils;
import com.sun.btrace.annotations.*;

import java.util.Map;

import static com.sun.btrace.BTraceUtils.*;

/**
 * 监控发送给ESB的性能
 * Author:  <a href="haif.yao@gmail.com">ivan</a>
 * Date: 14-3-13
 */
@BTrace
class RPCMonitorUseURL {


    private final String URL = "zj/ocs/owe/total/query";
    private final String MAP_KEY = "code_Number";

    @OnMethod(clazz = "com.ct10000.esb.client.ESBClientHessian", method = "call", location = @Location(Kind.RETURN))
    public void call( String servicePath,String channel,String module_name, Map<String,String> paramMap,@Duration long duration) {
        if (BTraceUtils.startsWith(str(servicePath), URL)){
            println(strcat(strcat(str(timeMillis()),":"),strcat(str(get(paramMap, MAP_KEY)), strcat(":", str(duration)))));
        }
    }
}
